import React, { Component } from 'react';
import { HashRouter, Route, Switch, Redirect } from 'react-router-dom';
import asyncComponent from '../http/asyncComponent'
const Header = asyncComponent(() => import("..//layout/header/header"));
const Index = asyncComponent(() => import("..//components/index/index"));
const Login = asyncComponent(() => import("..//components/login/login"));
const Register = asyncComponent(() => import("..//components/register/register"));
const MvDetail = asyncComponent(() => import("..//components/mvDetail/mvDetail"));
const Mv = asyncComponent(() => import("..//components/mv/mv"));
const Music = asyncComponent(() => import("..//components/music/music"));
const MuiscDetail = asyncComponent(() => import("..//components/muiscDetail/muiscDetail"));
const MusicPlay = asyncComponent(() => import("..//components/musicPlay/musicPlay"));
const Singer = asyncComponent(() => import("..//components/singer/singer"));
// import RouterMap from './routerMap'
let token = '11';
export default class Routers extends Component {
  render() {
    console.log('这是router')
    return (
      <HashRouter>
        {/* 公用头部 */}
        <Header/>
        {/* <Footer/> */}
        <Switch>
          <Route path="/login" component={Login} />
          <Route exact path="/index" component={Index} />
          <Route path="/register" component={Register} />
          <Route exact path="/mvDetail/:id" component={MvDetail} />
          <Route path="/mv" component={Mv} />
          <Route path="/music" component={Music} />
          <Route path="/muiscDetail/:id" component={MuiscDetail} />
          <Route path="/musicPlay/:id" component={MusicPlay} />
          <Route path="/singer" component={Singer} />
          {
            // RouterMap.map((item, index) => {
            //   if (item.auth) {
            //     console.log(item.path)
            //     return !token ? <Redirect to="/login" /> : <Route exact key={item.path} path={item.path} render={props => (
            //       <item.component {...props} />
            //     )} />

            //   } else {
            //     console.log(item.path)
            //     return <Route exact key={item.path} path={item.path} render={props => (
            //       <item.component {...props} />
                  
            //     )} />
            //   }
              
              
            // })
            

          }
          <Redirect to="/index" />
        </Switch>
      </HashRouter>
    );
  }
}
